<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<a href="<c:url value="/teacher/message/new" />" >
		<img src="<c:url value="/resources/compose.gif" />" />
		</a><br /><br />
<h3 id="oceny">Skrzynka odbiorcza:</h3>


<table class="content_table">
	<tr>
		<th>Od</th>
		<th style="width: 50%">Temat</th>
		<th>Opcje</th>
	</tr>
	
	<c:if test="${messages.size() == 0}">
		<tr>
		<td colspan="3" style="text-align: center; font-style: italic;">
			Skrzynka jest pusta
		</td>
		</tr>
	</c:if>
	
	<c:forEach items="${messages}" var="message">
	<tr>
		<td>${message.messages.usersByFrom.firstName} ${message.messages.usersByFrom.lastName}</td>
		<td style="width: 50%">
		<a href="<c:url value="/teacher/message/show" />?id=${message.messageReceivedId}" >
		${message.messages.messageTopic}
		</a>
		</td>
		<td>
		
		<a href="<c:url value="/teacher/message/delete" />?id=${message.messageReceivedId}" >
		<img src="<c:url value="/resources/delete.gif" />" />
		</a>
		</td>
	</tr>
	
	</c:forEach>
	
</table>

<br />

<!--  PAGE MENU -->
<c:if test="${messagesHolder.getPage() != 0}">
<a href="<c:url value="/teacher/messages" />?page=${messagesHolder.getPage()-1}" />
</c:if>
<
<c:if test="${messagesHolder.getPage() != 0}">
</a>
</c:if>
<c:forEach begin="0" end="${messagesHolder.getPageCount()-1}" var="page">
<c:if test="${messagesHolder.getPage() != page}">
<a href="<c:url value="/teacher/messages" />?page=${page}" />
</c:if>
${page+1}
<c:if test="${messagesHolder.getPage() != page}">
</a>
</c:if> 
</c:forEach>
<c:if test="${messagesHolder.getPage() != messagesHolder.getPageCount()-1}">
<a href="<c:url value="/teacher/messages" />?page=${messagesHolder.getPage()+1}" />
</c:if>
>
<c:if test="${messagesHolder.getPage() != 0}">
</a>
</c:if>
<!--  PAGE MENU KONIEC -->